
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tss.util.*"%>
<%@page import="com.store.*"%>
<%@page import="java.util.*"%>
<%@page import="com.jedi.*"%>
<%@include file="../global_var.jsp"%>
<%@page import="java.text.*"%>
<%@include file="../check_login.jsp"%>
<%
User just_user = (User)session.getAttribute("LoginUser");
String power_enable_id = "10704";
if (!just_user.hasPower(power_enable_id)) {
	out.println(strNoPowerInfo); 
	return;
}

String enddate = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
Calendar calen = Calendar.getInstance();
calen.setTime(TSSDate.parseDate(enddate));
calen.add(Calendar.YEAR, -1);
String begindate = new SimpleDateFormat("yyyy-MM-dd").format(calen.getTime());
String path = request.getContextPath();
String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
String begin_date        = ParamUtils.getParameter(request,"begin_date",begindate);//招标开始时间
String end_date          = ParamUtils.getParameter(request,"end_date",enddate);//招标结束时间
String salename =ParamUtils.getParameter(request,"salename","");//销售姓名
CompanySaleMgr comsaleMgr = new CompanySaleMgr();
List list = null;
%>
<html>
	<head>
		<base href="<%=basePath%>">
		<meta http-equiv="Content-Type" content="text/html; charset=GBK">
		<title></title>
		<link href="style/main.css" rel="stylesheet" type="text/css">
		<script language="javascript" src="js/common.js"></script>
		<script language="javascript">
function clk_contract_show(id) {
	right_menu_clk("comsale_show.jsp?comsaleid=" + id);
}
function clk_chanage(url){
	location.href=url;

}
</script>
	</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
	 <td >
		<form name="pageForm" method="post">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td height="100" valign="top" align="center" style="padding-top:12px;padding-bottom:10px;">
								
					<table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
					<tr bgcolor="#D7D7DB">
						<td height="24" style="padding-left:10px;" >
												销售员姓名：<input type="text" size="20" maxlength="30" name="salename" class="inputBox" value="<%=salename%>">

												
				 &nbsp;&nbsp;登记日期：
              
                  从 <span id="htmlBeginTime">&nbsp;</span> &nbsp; 至 &nbsp; <span id="htmlEndTime" >&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="submit" class="inputButton" value="确定">
												</td>
												<td align="right" width="11%">
												 <span onclick="right_menu_clk('comsale_add.jsp');" style="cursor:hand;font-size:12px;text-de--ation: underline;">添加销售员</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											</td>
										</tr>
										<tr bgcolor="#FFFFFF">
											<td height="15" style="padding-left:10px;" colspan="5">
											</td>
										</tr>
									</table>
									<table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
										<tr align="center" bgcolor="#858585">
											<td width="10%" height="24"><font color="#FFFFFF">销售员姓名</font></td>
											<td width="10%">
												<font color="#FFFFFF">厂商名称</font>
											</td>
										<td width="8%">
										
												<font color="#FFFFFF">销售员电话</font>
											</td>
											<td width="10%">
												<font color="#FFFFFF">E-mail</font>
											</td>
											<td width="10%">
												<font color="#FFFFFF">登记日期</font>
											</td>
												<td width="10%">
												<font color="#FFFFFF">备注</font>
											</td>
										<td width="7%"><font color="#FFFFFF">操作</font></td>
										</tr>
										<%String otherSQL = "";
										  if (!begin_date.trim().equals("")) otherSQL += " and substring(a.createtime for 10) >= '" + begin_date.trim() + "'";
	              
	              if (!end_date.trim().equals("")) otherSQL += " and substring(a.createtime for 10) <= '" + end_date.trim() + "'";
			if (!salename.trim().equals("")) otherSQL += " and a.salename like '%" + salename.trim() + "%'";
			
			String orderField = "a.createtime desc";
			int pageSize = 10;
			int pageno = 1;
			String page2 = request.getParameter("mgh");

			if (page2 == null || page2 == "") {
				pageno = 1;
			} else {
				pageno = Integer.parseInt(page2);
			}

			int pageNo = ParamUtils.getIntParameter(request, "page", pageno);
			String pageno1 = String.valueOf(pageNo);
			session.setAttribute("pageno1", pageno1);
			list = comsaleMgr.get(otherSQL, orderField, pageNo, pageSize);
			int total = comsaleMgr.getTotal();
			boolean b = (total % pageSize == 0);
			int pageCount = b ? (total / pageSize) : (total / pageSize + 1);
			if (pageNo > pageCount) {
				pageNo = pageCount;
			}
			if (list != null && list.size() > 0) {
				String bgColor[] = { "#EDEDF0", "#D7D7DB" };
				for(int i=0;i<list.size();i++) {
              		Companysale item = (Companysale)list.get(i);
              		Calendar cal = Calendar.getInstance();
              		cal.setTime(TSSDate.parseDate(item.getCreatetime()));
              		cal.add(Calendar.MONTH,-3);
              		String imgAlert = "";
              		if (cal.getTimeInMillis() < System.currentTimeMillis())
              			imgAlert = " <img src=\"images/contract_alert.gif\">";
              %>
					<tr align="center" bgcolor="<%=bgColor[i%2]%>" onMouseOver="this.style.background='#efefef'" onMouseOut="this.style.background='<%=bgColor[i%2]%>'">
						<td height="24"><a
							href="system_mgt/comsale_detail.jsp?comsaleid=<%=item.getSaleid()%>"><%=item.getSalename()%></a>
						</td>
											<td>
											<%=item.getComname_str()%>
											</td>
											<td>
												<%=item.getSaletel()%>
											</td>
											<td>
												<%=item.getSalemail()%>
											</td>
											<td>
												<%=item.getCreatetime() + imgAlert%>
											</td>
											<td>
												<%=item.getRemark()%>
											</td>
											<td>
												<span onclick="clk_contract_show('<%=item.getSaleid()%>');" style="cursor:hand;text-decoration: underline;">修改</span>
											</td>
										</tr>
										<%}%>
									</table>
									<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/page_img/page_bk.gif">

										<tr height="32" align="center" valign="bottom">
											<td width="5%">
												<img src="images/page_img/page_tag_01.gif">
											</td>
											<td height="35" align="right" style="padding-right:10px;" valign="bottom" id="pannelPageInfo">
												&nbsp;
											</td>
										</tr>
									</table>
									<script language="javascript">
            							pannelPageInfo.innerHTML = getPageInfo(<%=total%>,<%=pageSize%>,<%=pageNo%>,5,'images/page_img','pageForm');
            						</script>
									<%} else {%>
					
								<table width="95%" border="0" cellpadding="4" cellspacing="1" bgcolor="#FFFFFF">
									<tr>
										<td height="60" align="center">
											请选择条件查询信息!
										</td>
									</tr>
								</table>
								<%}%>
							</td>
						</tr>

				</table>
					</form>
				</td>
			</tr>
		</table>
<script language="javascript">
	htmlBeginTime.innerHTML = showCalenderInput("begin_date","pageForm","<%=begin_date%>",1);
	htmlEndTime.innerHTML = showCalenderInput("end_date","pageForm","<%=end_date%>",1);
</script>
	
	</body>
</html>
